{extends file="../acp.html"}

{block name="title"}{$head_title}{/block}
{block name="css"}
<link href="__PUBLIC__/Css/front/layer.css?version={$version}" type="text/css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/Public/Css/acp/AcoContract/contract_list.css?version={$version}"/>
<style type="text/css">
    .layermcont{
        text-align: center;
        overflow:hidden !important;
    }
    .layermchild .layermbtn span{
        color: #333;
    }
    .j_uploadBtn{
        display:block;
        width:120px !important;
        height:25px !important;
        position:absolute;
        top:40px !important;
        left:180px !important;
    }
</style>
{/block}
{block name="content"}
<form id="J_FormArticle" action="" method="post">

    <div class="formitems inline">
        <label class="fi-name">
            <span class="colorRed">*</span>客户性质：</label>
        <div class="form-controls">
            <select name="customer_type">
                <option value="">--请选择--</option>
                {foreach from=$customer_type_list item=item key = key}
                <option value="{$key}"{if $info.customer_type == $key}selected{/if}>{$item}</option>
                {/foreach}
            </select>
            <span class="fi-help-text error"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name">
            <span class="colorRed">*</span>项目性质：</label>
        <div class="form-controls">
            <select name="project_type">
                <option value="">--请选择--</option>
                {foreach from=$project_type_list item=item key = key}
                <option value="{$key}"{if $info.project_type == $key}selected{/if}>{$item}</option>
                {/foreach}
            </select>
            <span class="fi-help-text error"></span>
        </div>
    </div>

<div class="formitems inline">
    <label class="fi-name"><span class="colorRed">*</span>客户名称：</label>
    <div class="form-controls">
        <input type="text" placeholder="" class="xlarge" name="customer_name" id="customer_name" value="{$info.customer_name}">
        <span class="fi-help-text hide"></span>
    </div>
</div>

    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>联系人：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="small" name="likeman" id="likeman" value="{$info.likeman}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>职务：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="small" name="post" id="post" value="{$info.post}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>手机号码：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="mobile" id="mobile" value="{$info.mobile}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name">
            其他联系方式：</label>
        <div class="form-controls">
            <select name="other_link">
                <option value="">--请选择--</option>
                {foreach from=$other_link_list item=item key = key}
                <option value="{$key}" {if $info.other_link == $key}selected{/if}>{$item}</option>
                {/foreach}
            </select>
            <span class="fi-help-text error"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name">
            <span class="colorRed">*</span>行业领域：</label>
        <div class="form-controls">
            <select name="field">
                <option value="">--请选择--</option>
                {foreach from=$domain_list item=item key = key}
                <option value="{$item.type_id}"{if $info.field == $item.type_id}selected{/if}>{$item.type_name}</option>
                {/foreach}
            </select>
            <span class="fi-help-text error"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name">
            <span class="colorRed">*</span>客户来源：</label>
        <div class="form-controls">
            <select name="source">
                <option value="">--请选择--</option>
                {foreach from=$source_list item=item key = key}
                <option value="{$item.type_id}" {if $info.source == $item.type_id}selected{/if}>{$item.type_name}</option>
                {/foreach}
            </select>
            <span class="fi-help-text error"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name">
            <span class="colorRed">*</span>客户等级：</label>
        <div class="form-controls">
            <select name="level">
                <option value="">--请选择--</option>
                {foreach from=$level_list item=item key = key}
                <option value="{$key}"{if $info.level == $key}selected{/if}>{$item}</option>
                {/foreach}
            </select>
            <span class="fi-help-text error"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>初步洽谈时间：</label>
        <div class="mgt10">
            <div class="form-controls">
                <!--  <span class="tbs-txt">添加时间：</span>-->
                <input type="text" autocomplete="off" class="Wdate" name="first_talk_time" value="{if $info.first_talk_time}{$info|date_format:'%Y-%m-%d %H:%M'}{else}{/if}"  onclick="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm'})">
            </div>
        </div>
    </div>

    <hr/>
    <div class="formitems inline">
        <label class="fi-name">客户需求</label>
    </div>

    <div class="formitems inline">
        <label class="fi-name">租凭面积：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="mini" name="lease_area" id="lease_area" value="{$info.lease_area}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>
    <div class="formitems inline">
        <label class="fi-name">租凭工位：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="mini" name="lease_station" id="lease_station" value="{$info.lease_station}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>
    <div class="formitems inline">
        <label class="fi-name">合作意向：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="intent" id="intent" value="{$info.intent}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>
    <div class="formitems inline">
        <label class="fi-name">其他：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="other_contents" id="other_contents" value="{$info.other_contents}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>
    <div class="formitems inline">
        <label class="fi-name">需求备注：</label>
        <div class="form-controls">
            <textarea placeholder="" class="xlarge" name="remark" id="remark">{$info.remark}</textarea>
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <!--<div class="formitems inline">-->
        <!--<label class="fi-name">上传附件：</label>-->
        <!--<div class="form-controls">-->
            <!--<a href="javascript:;" id="file" onclick="add_file()" class="btn add_upload">上传附件</a>-->
            <!--<span class="fi-help-text hide"></span>-->
        <!--</div>-->
    <!--</div>-->

    <!--上传附件-->
    <div class="upload-file-wrap clearfix">
        <button class="upload-file-btn fl" id="upload-file-btn">上传附件</button>
        <input type="hidden" value="{$file_val}" id="file-inp" name='files' />

        <div class="upload-file fl">
            {foreach from=$files item=v}
            <div class="file-box fl">
                <input type="hidden" class="file_url" value="{$v}">
                <img src="/Public/Images/front/front_img/word.png" />
                <span class="del-file"></span>
            </div>
            {/foreach}
        </div>
    </div>


<div class="formitems inline">
    <label class="fi-name"></label>
    <div class="form-controls">
        <input type="hidden" name="act" value="{$act}" />
        <input type="hidden" name="customer_id" value="{$customer_id}" />
        <button type="submit" class="btn btn-blue"><i class="gicon-check white"></i>保存</button>
    </div>
</div>
</form>
{/block}
{block name="js"}
<script src="/Public/Plugins/My97DatePicker/WdatePicker.js?version={$version}"></script>
<script type="text/javascript" src="/Public/Js/front/front_js/ajaxupload.3.5.js"></script>
{literal}
<script>
    //上传附件
    new AjaxUpload("#upload-file-btn",{
        action: "/Acp/uploadFileHandler",
        name: "upfile",
        responseType: "json",
        onSubmit:function(){
            if($("#upload-file-btn").siblings('.upload-file').find('.file-box').length>=5){
                alert("最多上传5个附件");
                return false;
            }
        },
        onChange:function(file,extension){
            if(extension && /^(doc|docx|pdf|xls|xlsx|txt)$/.test(extension)) {
                return true;
            }else{
                layer.open({
                    content: '暂不支持该文件格式',
                    title: false,
                    btn: ['确定']
                });
                return false;
            }
        },
        onComplete:function(file,response){
            if(response.status === 0){
                console.log(response.msg);
            }else if(response.status === 1){

                var html='<div class="file-box fl">\
    			<input type="hidden" class="file_url" value="'+response.img_url+'">\
				<img src="/Public/Images/front/front_img/word.png" />\
				<span class="del-file"></span>\
			</div>';
                $(".upload-file").append(html);


                $('#file-inp').val(get_files());
            }
        }
    });

    //删除附件
    $("body").on('.del-file',"click",function(){
        $(this).parent().remove();
        $('#file-inp').val(get_files());
    });
    function get_files(){
        var files = '';
        $('.file_url').each(function(){
            files += $(this).val() + ','
        })
        return files;
    }
</script>
{/literal}
{/block}